<%@ page import="com.lihuanyu.upcOA.conn.databaseUtil" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Calendar" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  int tid = 0;
  if(session.getAttribute("tid") != null) {
    tid = Integer.parseInt(session.getAttribute("tid").toString());
  }
  Calendar a= Calendar.getInstance();
  int year=a.get(Calendar.YEAR);
  //System.out.print(year);
  request.setCharacterEncoding("utf-8");
  String teaname = request.getParameter("teaname") == null ? "" : new String(request.getParameter("teaname"));
  String projectname= request.getParameter("projectname") == null ? "" : new String(request.getParameter("projectname"));
  String xingzhi = request.getParameter("xingzhi") == null ? "" : new String(request.getParameter("xingzhi"));
  String category = request.getParameter("category") == null ? "" : new String(request.getParameter("category"));
  String money =request.getParameter("money") ==null ? "" :new String(request.getParameter("money"));
  databaseUtil db = new databaseUtil();
  String sql = "INSERT INTO `science_research`(`teaname`, `subjectname`, `nature`, `level`, `money`, `year`,`tid`) " +
          "VALUES ('"+teaname+"','"+projectname+"','"+xingzhi+"','"+category+"','"+money+"',"+year+","+tid+")";
  System.out.print(sql);
  db.executeUpdate(sql);
%>
<tr>
  <div class="col-md-1">
    <td>教师</td>
  </div>
  <div class="col-md-1">
    <td>项目名称</td>
  </div>
  <div class="col-md-1">
    <td>性质</td>
  </div>
  <div class="col-md-1">
    <td>级别</td>
  </div>
  <div class="col-md-1">
    <td>经费</td>
  </div>
</tr>
<form method="post" action="#" name="add_form">
  <tr style="display: none" class="add_row">
    <div class="col-md-1">
      <td><input type="text" name="teaname3" id="teaname3"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="projectname" id="projectname"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="xingzhi" id="xingzhi"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="jibie" id="category"></td>
    </div>
    <div class="col-md-1">
      <td><input type="text" name="jingfei" id="money"></td>
    </div>
  </tr>
</form>
<%
  sql="select * from science_research where tid="+tid;
  System.out.print(sql);
  db.executeQuery(sql);
  ResultSet rs = db.getRs();
  while (rs.next()){
    String teachername= rs.getString(2);
    String proname =    rs.getString(3);
    String nature  =      rs.getString(4);
    String level =     rs.getString(5);
    String tmoney =     rs.getString(6);
%>
<tr class="second">
  <div class="col-md-1">
    <td><%=teachername%></td>
  </div>
  <div class="col-md-1">
    <td><%=proname%></td>
  </div>
  <div class="col-md-1">
    <td><%=nature%></td>
  </div>
  <div class="col-md-1">
    <td><%=level%></td>
  </div>
  <div class="col-md-1">
    <td><%=tmoney%></td>
  </div>
</tr>
<%
  }
  db.sqlclose();
%>

